import store from '../store/index.js'
import config from './config.js'
const auth = () => {
	// return
	// h5获取链接中参数的方法
	// const getQuery = () => {
	// 	const search = window.location.search;
	// 	if(!!!search) return null;
	// 	const str = search.replace('?','');
	// 	const keyValues = str.split('&');
	// 	let obj = {};
	// 	keyValues.forEach(item => {
	// 		const keyAndValue = item.split('=');
	// 		obj[keyAndValue[0]] = keyAndValue[1]
	// 	})
	// 	return obj
	// }
	// store.commit('setToken','');
	// const query = getQuery()
	// let queryArr = [];
	// if(query) {
	// 	for(let key in query) {
	// 		if(['code','state'].indexOf(key) === -1) {
	// 			queryArr.push(`${key}=${query[key]}`)
	// 		}
	// 	}
	// }
	// let queryString = '';
	// if(queryArr.length > 0) {
	// 	queryString += `?${queryArr.join('&')}`
	// }
	// code失效
	// window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.appid}&redirect_uri=${encodeURIComponent(window.location.origin + window.location.pathname + queryString)}&response_type=code&scope=snsapi_base&state=null#wechat_redirect`
	store.commit('setToken','');
	window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx18be50e37350dfea&redirect_uri=https%3A%2F%2Fgptp.gxmob.cn%2Fapi%2FoauthCallback&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'				
}
export default auth